package com.kf.lib_widget.divider

import android.content.Context
import android.graphics.Color
import com.yanyusong.y_divideritemdecoration.Dp2Px
import com.yanyusong.y_divideritemdecoration.Y_Divider
import com.yanyusong.y_divideritemdecoration.Y_DividerBuilder
import com.yanyusong.y_divideritemdecoration.Y_DividerItemDecoration

class ParkingDivider(val context: Context) : Y_DividerItemDecoration(context) {
    override fun getDivider(itemPosition: Int): Y_Divider? {
        var divider: Y_Divider? = null

        if (itemPosition % 6 != 0) {
            var builder = Y_DividerBuilder()
            builder.setRightSideLine(
                true,
                Color.WHITE,
                Dp2Px.convert(context, 0.5f).toFloat(),
                0f,
                0f
            )

            builder.setBottomSideLine(
                true,
                Color.WHITE,
                Dp2Px.convert(context, 0.5f).toFloat(),
                0f,
                0f
            )
            divider = builder.create()
        }else{
            var builder = Y_DividerBuilder()
            builder.setRightSideLine(
                true,
                Color.parseColor("#CDCECF"),
                Dp2Px.convert(context, 0.5f).toFloat(),
                0f,
                0f
            )

            builder.setBottomSideLine(
                true,
                Color.parseColor("#CDCECF"),
                Dp2Px.convert(context, 0.5f).toFloat(),
                0f,
                0f
            )
            divider = builder.create()
        }



        return divider

    }
}